package com.yunpuvip.sachet.biz.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yunpuvip.sachet.biz.entity.BalanceHistory;
import com.yunpuvip.sachet.biz.entity.Order;
import com.yunpuvip.sachet.biz.entity.Payment;
import com.baomidou.mybatisplus.core.metadata.*;
import com.yunpuvip.sachet.biz.model.params.BalanceHistoryParam;
import com.yunpuvip.sachet.biz.model.result.BalanceHistoryResult;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yunpuvip.sachet.modular.page.LayuiPageInfo;
import com.yunpuvip.sachet.modular.vo.rest.request.BalanceReqVo;

import java.math.BigDecimal;
import java.util.List;

/**
 * <p>
 * 余额变动历史 服务类
 * </p>
 *
 * @author wushaohong
 * @since 2019-08-10
 */
public interface BalanceHistoryService extends IService<BalanceHistory> {

    /**
     * 新增
     *
     * @author wushaohong
     * @Date 2019-08-10
     */
    void add(BalanceHistoryParam param);

    /**
     * 删除
     *
     * @author wushaohong
     * @Date 2019-08-10
     */
    void delete(BalanceHistoryParam param);

    /**
     * 更新
     *
     * @author wushaohong
     * @Date 2019-08-10
     */
    void update(BalanceHistoryParam param);

    /**
     * 查询单条数据，Specification模式
     *
     * @author wushaohong
     * @Date 2019-08-10
     */
    BalanceHistoryResult findBySpec(BalanceHistoryParam param);

    /**
     * 查询列表，Specification模式
     *
     * @author wushaohong
     * @Date 2019-08-10
     */
    List<BalanceHistoryResult> findListBySpec(BalanceHistoryParam param);

    /**
     * 查询分页数据，Specification模式
     *
     * @author wushaohong
     * @Date 2019-08-10
     */
     LayuiPageInfo findPageBySpec(BalanceHistoryParam param);


    /**
     * 插入
     * @param payment
     */
     Integer  insertAddBanlanceHistory(Payment payment);

    /**
     * 减去余额
     * @param sub
     * @return
     */
     Integer  insertSubBanlanceHistoryAndSubPlayerBalance(BigDecimal sub,Integer playerId,Payment payment);


    /**
     * 根据时间获取余额记录
     * @param day
     * @return
     */
     IPage<BalanceHistory> getBalancePage(BalanceReqVo balanceReqVo);

    /**
     *
     * @param  Order
     * @return
     */
     boolean DrawBackaAndAddBanlanceHistory(Order Order);
}
